/**
 * Created by Administrator on 2017/3/23 0023.
 */
var Page8={
    create:function () {
        var page={};

        page.ui=new PIXI.DisplayObjectContainer();

        var bg=new PIXI.Graphics();
        bg.beginFill(0xffffff,1);
        bg.drawRect(0,0,pixiStageW,pixiStageH);
        bg.endFill();
        page.ui.addChild(bg);

        var circle=new PIXI.Sprite(resource['assets/images/p8_circle.png'].texture);
        circle.anchor.set(0.5);
        circle.x=392;
        circle.y=322;
        page.ui.addChild(circle);
        TweenMax.to(circle,15,{rotation:Math.PI*2,ease:Linear.easeNone,repeat:-1});

        var circle1=new PIXI.Sprite(resource['assets/images/p8_circle.png'].texture);
        circle1.anchor.set(0.5);
        circle1.x=740;
        circle1.y=322;
        page.ui.addChild(circle1);
        TweenMax.to(circle1,15,{rotation:-Math.PI*2,ease:Linear.easeNone,repeat:-1});

        var flower=new  PIXI.Sprite(resource['assets/images/p8_flower.png'].texture);
        flower.anchor.set(0.5);
        flower.x=556;
        flower.y=359;
        page.ui.addChild(flower);

        var t0=new PIXI.Sprite(resource['assets/images/p8_t0.png'].texture);
        t0.anchor.set(0.5);
        t0.x=580;
        t0.y=267;
        page.ui.addChild(t0);

        var t1=new PIXI.Sprite(resource['assets/images/p8_t1.png'].texture);
        t1.anchor.set(0.5);
        t1.x=575;
        t1.y=317;
        page.ui.addChild(t1);
        
        page.In=function () {
            bg.alpha=0;
            TweenMax.to(bg,1.5,{delay:0,alpha:1});

            t0.alpha=0;
            t0.y=297+50;
            TweenMax.to(t0,1.2,{delay:4,y:297,alpha:1,ease:Cubic.easeInOut});
            t1.alpha=0;
            t1.y=347+50;
            TweenMax.to(t1,1.2,{delay:4.5,y:347,alpha:1,ease:Cubic.easeInOut});

            flower.scale.x=flower.scale.y=0;
            flower.alpha=1;
            TweenMax.to(flower.scale,1.2,{delay:3,x:1,y:1,ease:Back.easeOut});

            circle.alpha=0;
            circle.x=392-100;
            TweenMax.to(circle,1.2,{delay:1.5,x:392,alpha:1,ease:Back.easeInOut});

            circle1.alpha=0;
            circle1.x=740+100;
            TweenMax.to(circle1,1.2,{delay:1.5,x:740,alpha:1,ease:Back.easeInOut});
            
            setTimeout(function () {
                console.log('wwwwwwhyr')
                var event = new CustomEvent("Game_PageIn",{'detail':9});
                document.dispatchEvent(event);
            },6000);
        }

        return page;
    }
}